﻿using System;
using System.Configuration;

namespace ML.Utils
{
    /// <summary>
    /// 读取Web.Config公共类
    /// </summary>
    public static class ConfigHelper
    {
        /// <summary>
        /// 数据库连接字符串的读取
        /// </summary>
        public static string ConnectionString
        {
            get
            {
                return ConfigurationManager.ConnectionStrings["ML_DB_ChineseRestaurant"].ConnectionString;
            }
        }

        /// <summary>
        /// 获取资金账户数据的定时执行的cron
        /// </summary>
        public static string CapitalAccountTimer
        {
            get
            {
                return ConfigurationManager.AppSettings["CapitalAccountTimer"];
            }
        }

        /// <summary>
        /// 产品销量定时执行的cron
        /// </summary>
        public static string ProductTimer
        {
            get
            {
                return ConfigurationManager.AppSettings["ProductTimer"];
            }
        }

        /// <summary>
        /// 定时扫描完成订单
        /// </summary>
        public static string OrderStateTimer
        {
            get
            {
                return ConfigurationManager.AppSettings["OrderStateTimer"];
            }
        }

        /// <summary>
        /// 微信AppID
        /// </summary>
        public static string WechatAppId
        {
            get
            {
                return ConfigurationManager.AppSettings["WechatAppId"];
            }
        }

        /// <summary>
        /// 微信AppSecret
        /// </summary>
        public static string WechatAppSecret
        {
            get
            {
                return ConfigurationManager.AppSettings["WechatAppSecret"];
            }
        }

        /// <summary>
        /// 微信绑定的网站访问地址
        /// </summary>
        public static string WechatWebSite
        {
            get
            {
                return ConfigurationManager.AppSettings["WechatWebSite"];
            }
        }

        /// <summary>
        /// 读取泰铢转人民币的浮动汇率
        /// </summary>
        public static decimal FuDongHuiLv
        {
            get
            {
                return Convert.ToDecimal(ConfigurationManager.AppSettings["fuDongHuiLv"]);
            }
        }

        /// <summary>
        /// 读取泰铢转人民币的默认汇率
        /// </summary>
        public static decimal DefaultHuiLv
        {
            get
            {
                return Convert.ToDecimal(ConfigurationManager.AppSettings["defaultHuiLv"]);
            }
        }

        /// <summary>
        /// 读取当天指定时间以前未支付订单的指定时间
        /// </summary>
        public static int OrderCancelTime
        {
            get { return Convert.ToInt32(ConfigurationManager.AppSettings["OrderCancelTime"]); }
        }

        /// <summary>
        /// 读取当天指定时间以前未支付订单定时执行的cron
        /// </summary>
        public static string OrderCancelTimer
        {
            get { return ConfigurationManager.AppSettings["OrderCancelTimer"]; }
        }
    }
}